package com.yfq.springframework.util;

import java.lang.reflect.Field;

/**
 * @author 姚凤桥
 * @date 2022/11/22 17:06
 * @description
 */
@SuppressWarnings("all")
public class BeanUtils {
    public static void setFieldValue(Object bean, String name, Object value) {
        Class<?> aClass = bean.getClass();
        try {
            Field field = aClass.getDeclaredField(name);
            field.setAccessible(true);
            field.set(bean, value);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
